var express = require("express");
var sd = require('silly-datetime');
const axios = require('axios')

var app = express();
var HOSTNAME = '0.0.0.0';
var PORT = 8080;



app.post("*", async function (req, res) {
  url_re1 = /^https?:\/\/i.cqu.edu.cn\/qljfwapp\/sys\/emapflow\/\*default\/index\/queryUserTasks\.do$/
  url_re2 = /^https?:\/\/i.cqu.edu.cn\/qljfwapp\/sys\/lwCquElectronicPassApply\/modules\/application\/T_PUB_ELECTRONICPASS_APPLY_QUERY.do$/
  if (req.url.match(url_re1) || req.url.match(url_re2)) {
    await axios({
      method: req.method,
      url: req.url,
      headers: req.headers
    }).then((response) => {
      // console.log(response);
      res.send(response.data)
      // res.send("response.data")
    });
  }
})

app.listen(PORT, HOSTNAME, function () {
  console.log(`服务器运行在http://${HOSTNAME}:${PORT}`);

});